package com.mervin.patterns.composite;

import java.util.ArrayList;
import java.util.List;

/***************************************
 * @Auther: mervin
 * @Date: 2020-04-21 23:41
 * @Description: 大学 合成部件（Composite）
 ***************************************/
public class University extends OrganizationComponent {

    List<OrganizationComponent> organizationComponentList = new ArrayList<OrganizationComponent>();

    public University(String name, String desc) {
        super(name, desc);
    }

    @Override
    protected void add(OrganizationComponent organizationComponent) {
        organizationComponentList.add(organizationComponent);
    }

    @Override
    protected void remove(OrganizationComponent organizationComponent) {
        organizationComponentList.remove(organizationComponent);
    }

    @Override
    public String getName() {
        return super.getName();
    }

    @Override
    public String getDesc() {
        return super.getDesc();
    }

    @Override
    protected void print() {
        System.out.println("============" + getName() + "===========");
        organizationComponentList.forEach(OrganizationComponent::print);
    }
}
